<?php
/**
 * CreateTime: 2022/12/9 15:35
 */

namespace App\Http\Controllers\Config;

use App\Consts\ResponseConsts\ResponseStatusConsts;
use App\Func\ResponseFunc;
use App\Http\Controllers\Controller;
use App\Models\Config\SystemConfigModel;

class SystemConfigController extends Controller
{
    public function getSystemConfig(){
        $scm = new SystemConfigModel();
        return ResponseFunc::returnJson(
            'ok',
            [
                'value' => $scm->getValue()['custom_config_value']
            ],
            '获取配置成功',
            ResponseStatusConsts::OK_200_RESPONSE_STATUS
        );
    }

    public function setSystemConfig(){
        $data = request()->all();
        $scm = new SystemConfigModel();
        $scm->setValue($data);
        return ResponseFunc::returnJson(
            'ok',
            null,
            '编辑配置成功',
            ResponseStatusConsts::OK_200_RESPONSE_STATUS
        );
    }
}